# 添加索引
## t_decision_result_detail集合添加索引：
db.getCollection("t_decision_result_detail").createIndex({"requestId":1,{background: true,sparse: true}});
db.getCollection("t_decision_result_detail").createIndex({"decisionId":1,{background: true,sparse: true}});
db.getCollection("t_decision_result_detail").createIndex({"engineCode":1,"createTime":1,{background: true,sparse: true}});
db.getCollection("t_decision_result_detail").createIndex({"updateTime":1,{background: true,sparse: true}});

##t_decision_node_log 集合添加索引：
db.getCollection("t_decision_node_log").createIndex({"requestId":1,{background: true,sparse: true}});
db.getCollection("t_decision_node_log").createIndex({"decisionId":1,{background: true,sparse: true}});
db.getCollection("t_decision_node_log").createIndex({"engineCode":1,"createTime":1,{background: true,sparse: true}});
db.getCollection("t_decision_node_log").createIndex({"updateTime":1,{background: true,sparse: true}});


##t_decision_query_log 集合添加索引：
db.getCollection("t_decision_query_log").createIndex({"requestId":1,{background: true,sparse: true}});
db.getCollection("t_decision_query_log").createIndex({"decisionId":1,{background: true,sparse: true}});
db.getCollection("t_decision_query_log").createIndex({"engineCode":1,"createTime":1,{background: true,sparse: true}});
db.getCollection("t_decision_query_log").createIndex({"updateTime":1,{background: true,sparse: true}});


# 开启分片
sh.enableSharding("riskmanage_log");

# 创建分片

sh.shardCollection("riskmanage_log.t_decision_result_detail",{"engineCode":1,"createTime":1});
sh.shardCollection("riskmanage_log.t_decision_node_log",{"engineCode":1,"createTime":1});
sh.shardCollection("riskmanage_log.t_decision_query_log",{"engineCode":1,"createTime":1});


